/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * AddQuestionForm.java
 *
 * Created on Apr 10, 2012, 3:54:15 PM
 */
package Admin;

import Constructor.Common;
import Constructor.KeyValue;
import DAO.DAO_Answer;
import DAO.DAO_Category_Question;
import DAO.DAO_Question;
import Model.Model_Answer;
import Model.Model_Category_Question;
import Model.Model_Question;
import java.awt.Dimension;
import java.awt.Image;
import java.awt.Toolkit;
import java.util.ArrayList;
import javax.swing.ImageIcon;
import javax.swing.JOptionPane;

/**
 *
 * @author Admin
 */
public class AddQuestionForm extends javax.swing.JDialog {

    private static String option1 = "0";
    private static String option2 = "0";
    private static String option3 = "0";
    private static String option4 = "0";
    private static String correct1 = "0";
    private static String correct2 = "0";
    private static String correct3 = "0";
    private static String correct4 = "0";
    private static String id;
    DAO_Category_Question daoCategory = new DAO_Category_Question();
    DAO_Question daoQuestion = new DAO_Question();
    DAO_Answer daoAnwer = new DAO_Answer();
    Model_Question modQuestion = new Model_Question();
    ArrayList<Model_Answer> listAnswer = new ArrayList<Model_Answer>();
    String status = "0";

    /** Creates new form AddQuestionForm */
    public AddQuestionForm(java.awt.Frame parent, boolean modal) {
        super(parent, modal);
        initComponents();
        loadFrom();
    }

    // set size form
    private void loadFrom() {
        if (Common._Question.equals("Add")) {
            setTitle("Add Question");
            lblTitle.setText("Add Question");
            butAdd.setText("Add");
            butAdd.setVisible(false);
        } else {
            setTitle("Update Question");
            butAdd.setText("Update");
            butAdd.setVisible(true);
            lblTitle.setText("Update Question");
        }

        this.setSize(500, 450);
        ImageIcon icon = new ImageIcon(getClass().getResource("/Images/logo.png"));
        Image image = icon.getImage();
        setIconImage(image);
        Dimension ScreenSize = Toolkit.getDefaultToolkit().getScreenSize();
        setLocation((ScreenSize.width - 500) / 2, (ScreenSize.height - 450) / 2);
        setResizable(false);
        //butAdd.setVisible(false);
        loadCategory();
    }

    //load category Combobox
    private void loadCategory() {
        cboCategory.removeAllItems();
        if (Common._Question.equals("Update")) {
            Model_Category_Question modelQuest = daoCategory.getOneCategoryByID(Common._CategoryID);
            ArrayList<Model_Category_Question> listCus = daoCategory.getAllCategory();
            for (Model_Category_Question model_Category_Question : listCus) {
                cboCategory.addItem(new KeyValue(model_Category_Question.getName(), model_Category_Question.getId()));
            }
            cboCategory.setSelectedItem(new KeyValue(modelQuest.getName(), modelQuest.getId()));
            modQuestion = daoQuestion.get_QuestionByID(Common._AdminQuestion_ID);
            tarContent.setText(modQuestion.getContent());
            status = modQuestion.getStatus();

            listAnswer = daoAnwer.get_AnswerbyQuestionID(Integer.parseInt(Common._AdminQuestion_ID));
            String strOption[] = {option1, option2, option3, option4};
            String strCorrect[] = {correct1, correct2, correct3, correct4};
            int i = 0;
            for (Model_Answer modAnswer : listAnswer) {
                strOption[i] = modAnswer.getContent();
                strCorrect[i] = modAnswer.getCorrect();
                i++;
            }
            txtOption1.setText(strOption[0].toString());
            txtOption2.setText(strOption[1].toString());
            txtOption3.setText(strOption[2].toString());
            txtOption4.setText(strOption[3].toString());
            /*if (strCorrect[0].equals("1")) {
            chkOption1.setSelected(true);
            chkOption2.setVisible(false);
            chkOption3.setVisible(false);
            chkOption4.setVisible(false);
            } else if (strCorrect[1].equals("1")) {
            chkOption2.setSelected(true);
            chkOption1.setVisible(false);
            chkOption3.setVisible(false);
            chkOption4.setVisible(false);
            } else if (strCorrect[2].equals("1")) {
            chkOption3.setSelected(true);
            chkOption1.setVisible(false);
            chkOption2.setVisible(false);
            chkOption4.setVisible(false);
            } else if (strCorrect[3].equals("1")) {
            chkOption4.setSelected(true);
            chkOption1.setVisible(false);
            chkOption3.setVisible(false);
            chkOption2.setVisible(false);
            }*/
        } else {

            ArrayList<Model_Category_Question> listCus = daoCategory.getAllCategory();
            cboCategory.addItem(new KeyValue("", ""));
            for (Model_Category_Question model_Category_Question : listCus) {
                cboCategory.addItem(new KeyValue(model_Category_Question.getName(), model_Category_Question.getId()));
            }
        }
        Common._CategoryID = "";
    }

    private boolean checkInformationQuestion() {
        boolean result = false;

        if (option1.equals("0") && option2.equals("0") && option3.equals("0") && option4.equals("0")) {
            JOptionPane.showMessageDialog(this, "You do not choose the answer! ");
        } else {
            if (cboCategory.toString().equals("")) {
                JOptionPane.showMessageDialog(this, "You do not choose the Category Question! ");
            } else {
                if (tarContent.getText().equals("")) {
                    JOptionPane.showMessageDialog(this, "Category Question Is not null! ");
                } else {
                    if (txtOption1.getText().equals("")) {
                        JOptionPane.showMessageDialog(this, "Option 1 is not null! ");
                    } else {
                        if (txtOption2.getText().equals("")) {
                            JOptionPane.showMessageDialog(this, "Option 2 is not null! ");
                        } else {
                            if (txtOption3.getText().equals("")) {
                                JOptionPane.showMessageDialog(this, "Option 3 is not null! ");
                            } else {
                                if (txtOption4.getText().equals("")) {
                                    JOptionPane.showMessageDialog(this, "Option 4 is not null! ");
                                } else {
                                    result = true;
                                }
                            }
                        }
                    }
                }
            }
        }
        return result;
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        lblTitle = new javax.swing.JLabel();
        cboCategory = new javax.swing.JComboBox();
        jScrollPane1 = new javax.swing.JScrollPane();
        tarContent = new javax.swing.JTextArea();
        lblCategory = new javax.swing.JLabel();
        lblContent = new javax.swing.JLabel();
        lblOption1 = new javax.swing.JLabel();
        txtOption1 = new javax.swing.JTextField();
        lblOption2 = new javax.swing.JLabel();
        lblOption3 = new javax.swing.JLabel();
        lblOption4 = new javax.swing.JLabel();
        txtOption2 = new javax.swing.JTextField();
        txtOption3 = new javax.swing.JTextField();
        txtOption4 = new javax.swing.JTextField();
        butAdd = new javax.swing.JButton();
        butCancel = new javax.swing.JButton();
        chkOption1 = new javax.swing.JCheckBox();
        chkOption2 = new javax.swing.JCheckBox();
        chkOption3 = new javax.swing.JCheckBox();
        chkOption4 = new javax.swing.JCheckBox();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);

        lblTitle.setFont(new java.awt.Font("Tahoma", 1, 18));
        lblTitle.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        lblTitle.setText("Add Question");

        cboCategory.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cboCategoryActionPerformed(evt);
            }
        });

        tarContent.setColumns(20);
        tarContent.setRows(5);
        jScrollPane1.setViewportView(tarContent);

        lblCategory.setText("Question Category ");

        lblContent.setText("Question Content");

        lblOption1.setText("Option 1");

        lblOption2.setText("Option 2");

        lblOption3.setText("Option 3");

        lblOption4.setText("Option 4");

        butAdd.setText("Add");
        butAdd.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                butAddActionPerformed(evt);
            }
        });

        butCancel.setText("Cancel");
        butCancel.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                butCancelActionPerformed(evt);
            }
        });

        chkOption1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                chkOption1ActionPerformed(evt);
            }
        });

        chkOption2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                chkOption2ActionPerformed(evt);
            }
        });

        chkOption3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                chkOption3ActionPerformed(evt);
            }
        });

        chkOption4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                chkOption4ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(layout.createSequentialGroup()
                            .addGap(75, 75, 75)
                            .addComponent(lblTitle, javax.swing.GroupLayout.PREFERRED_SIZE, 287, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGroup(layout.createSequentialGroup()
                            .addContainerGap()
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                .addComponent(lblCategory, javax.swing.GroupLayout.DEFAULT_SIZE, 112, Short.MAX_VALUE)
                                .addComponent(lblContent, javax.swing.GroupLayout.PREFERRED_SIZE, 103, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(cboCategory, javax.swing.GroupLayout.PREFERRED_SIZE, 197, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                        .addComponent(txtOption1, javax.swing.GroupLayout.DEFAULT_SIZE, 234, Short.MAX_VALUE)
                                        .addComponent(txtOption3, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 234, Short.MAX_VALUE)
                                        .addComponent(txtOption2, javax.swing.GroupLayout.DEFAULT_SIZE, 234, Short.MAX_VALUE)
                                        .addComponent(txtOption4, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 234, Short.MAX_VALUE))
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                        .addComponent(chkOption3)
                                        .addComponent(chkOption2)
                                        .addComponent(chkOption4)
                                        .addComponent(chkOption1))
                                    .addGap(47, 47, 47))
                                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 284, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addGroup(layout.createSequentialGroup()
                            .addContainerGap()
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                .addComponent(lblOption1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(lblOption2, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(lblOption4, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(lblOption3, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 83, javax.swing.GroupLayout.PREFERRED_SIZE))))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(64, 64, 64)
                        .addComponent(butAdd, javax.swing.GroupLayout.PREFERRED_SIZE, 162, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(39, 39, 39)
                        .addComponent(butCancel, javax.swing.GroupLayout.PREFERRED_SIZE, 151, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(lblTitle, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(lblCategory)
                    .addComponent(cboCategory, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(lblContent)
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 86, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(lblOption1)
                        .addComponent(txtOption1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(chkOption1))
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(chkOption2)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(lblOption2)
                        .addComponent(txtOption2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(lblOption3)
                        .addComponent(txtOption3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(chkOption3))
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(chkOption4)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(lblOption4)
                        .addComponent(txtOption4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 8, Short.MAX_VALUE)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(butAdd)
                    .addComponent(butCancel))
                .addGap(34, 34, 34))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void butCancelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_butCancelActionPerformed
        // TODO add your handling code here:
        if (JOptionPane.showConfirmDialog(this, "Do you really want to exit? ") == JOptionPane.YES_OPTION) {
            this.setVisible(false);
            Common._AdminQuestion_ID = "";
        }
    }//GEN-LAST:event_butCancelActionPerformed

    /** This method is load Database  from within form manager Question
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    private void chkOption1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chkOption1ActionPerformed
        // TODO add your handling code here:
        if (chkOption1.isSelected()) {
            chkOption2.setVisible(false);
            chkOption3.setVisible(false);
            chkOption4.setVisible(false);
            butAdd.setVisible(true);
            option1 = "1";
        } else {
            chkOption1.setVisible(true);
            chkOption2.setVisible(true);
            chkOption3.setVisible(true);
            chkOption4.setVisible(true);
            butAdd.setVisible(false);
            option1 = "0";
        }
    }//GEN-LAST:event_chkOption1ActionPerformed

    private void chkOption2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chkOption2ActionPerformed
        // TODO add your handling code here:
        if (chkOption2.isSelected()) {
            chkOption1.setVisible(false);
            chkOption3.setVisible(false);
            chkOption4.setVisible(false);
            butAdd.setVisible(true);
            option2 = "1";
        } else {
            chkOption1.setVisible(true);
            chkOption2.setVisible(true);
            chkOption3.setVisible(true);
            chkOption4.setVisible(true);
            butAdd.setVisible(false);
            option2 = "0";
        }
    }//GEN-LAST:event_chkOption2ActionPerformed

    private void chkOption3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chkOption3ActionPerformed
        // TODO add your handling code here:
        if (chkOption3.isSelected()) {
            chkOption1.setVisible(false);
            chkOption2.setVisible(false);
            chkOption4.setVisible(false);
            butAdd.setVisible(true);
            option3 = "1";

        } else {
            chkOption1.setVisible(true);
            chkOption2.setVisible(true);
            chkOption3.setVisible(true);
            chkOption4.setVisible(true);
            butAdd.setVisible(false);
            option3 = "0";

        }
    }//GEN-LAST:event_chkOption3ActionPerformed

    private void chkOption4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chkOption4ActionPerformed
        // TODO add your handling code here:
        if (chkOption4.isSelected()) {
            chkOption1.setVisible(false);
            chkOption2.setVisible(false);
            chkOption3.setVisible(false);
            butAdd.setVisible(true);
            option4 = "1";
        } else {
            chkOption1.setVisible(true);
            chkOption2.setVisible(true);
            chkOption3.setVisible(true);
            chkOption4.setVisible(true);
            butAdd.setVisible(false);
            option4 = "0";
        }
    }//GEN-LAST:event_chkOption4ActionPerformed

    private void butAddActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_butAddActionPerformed
        // TODO add your handling code here:
        if (butAdd.getText().equals("Add")) {
            boolean result1 = checkInformationQuestion();
            if (result1 == true) {
                modQuestion.setCategory_ID(id);
                modQuestion.setContent(tarContent.getText());
                modQuestion.setStatus("0");

                int result2 = daoQuestion.insert_Question(modQuestion);
                if (result2 == 1) {
                    //create Arry recipient Option
                    String strOption[] = {txtOption1.getText(), txtOption2.getText(), txtOption3.getText(), txtOption4.getText()};
                    //create arry recipient correct
                    String strCorrect[] = {correct1, correct2, correct3, correct4};
                    //take out late-breaking value.
                    Model_Question question = daoQuestion.get_TopQuestion();
                    for (int i = 0; i < strOption.length; i++) {
                        Model_Answer modAnwer = new Model_Answer();
                        modAnwer.setQuestion_id(question.getId());
                        modAnwer.setContent(strOption[i].toString());
                        modAnwer.setCorrect(strCorrect[i].toString());
                        // arry.add(modAnwer);
                        boolean result3 = daoAnwer.insertAnswer(modAnwer);
                        if (result3 == true) {
                            butAdd.setVisible(false);
                            this.setVisible(false);
                        }
                    }
                } else {
                    JOptionPane.showMessageDialog(this, "The question existed. Please enter another question! ");
                    this.setVisible(false);
                    AddQuestionForm fm = new AddQuestionForm(null, rootPaneCheckingEnabled);
                    fm.setVisible(true);
                }
            }
        } else {
            boolean result1 = checkInformationQuestion();
            if (result1 == true) {
                modQuestion.setId(Common._AdminQuestion_ID);
                modQuestion.setCategory_ID(id);
                modQuestion.setContent(tarContent.getText());
                modQuestion.setStatus(status);

                int result2 = daoQuestion.Update_Question(modQuestion);
                if (result2 == 1) {
                    //create Arry recipient Option
                    String strOption[] = {txtOption1.getText(), txtOption2.getText(), txtOption3.getText(), txtOption4.getText()};
                    //create arry recipient correct

                    String strCorrect[] = {correct1, correct2, correct3, correct4};
                    listAnswer = daoAnwer.get_AnswerbyQuestionID(Integer.parseInt(Common._AdminQuestion_ID));
                    int i = 0;
                    for (Model_Answer modAnswer : listAnswer) {
                        Model_Answer modAnwer1 = new Model_Answer();
                        modAnwer1.setId(modAnswer.getId());
                        modAnwer1.setQuestion_id(modAnswer.getQuestion_id());
                        modAnwer1.setContent(strOption[i]);
                        modAnwer1.setCorrect(strCorrect[i]);
                        int result3 = daoAnwer.Updatet_Answer(modAnwer1);
                        if (result3 == 1) {
                            i++;
                        }
                    }
                    if (i == 4) {
                        butAdd.setVisible(false);
                        this.setVisible(false);
                    }
                } else {
                    JOptionPane.showMessageDialog(this, "The question not existed. Please enter another question! ");
                    this.setVisible(false);
                    AddQuestionForm fm = new AddQuestionForm(null, rootPaneCheckingEnabled);
                    fm.setVisible(true);
                }
            }
        }
    }//GEN-LAST:event_butAddActionPerformed

    private void cboCategoryActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cboCategoryActionPerformed
        // TODO add your handling code here:
        id = ((KeyValue) cboCategory.getSelectedItem()).getValue();

    }//GEN-LAST:event_cboCategoryActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /*java.awt.EventQueue.invokeLater(new Runnable() {
        
        public void run() {
        AddQuestionForm dialog = new AddQuestionForm(new javax.swing.JFrame(), true);
        dialog.addWindowListener(new java.awt.event.WindowAdapter() {
        
        public void windowClosing(java.awt.event.WindowEvent e) {
        System.exit(0);
        }
        });
        dialog.setVisible(true);
        }
        });*/
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton butAdd;
    private javax.swing.JButton butCancel;
    private javax.swing.JComboBox cboCategory;
    private javax.swing.JCheckBox chkOption1;
    private javax.swing.JCheckBox chkOption2;
    private javax.swing.JCheckBox chkOption3;
    private javax.swing.JCheckBox chkOption4;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JLabel lblCategory;
    private javax.swing.JLabel lblContent;
    private javax.swing.JLabel lblOption1;
    private javax.swing.JLabel lblOption2;
    private javax.swing.JLabel lblOption3;
    private javax.swing.JLabel lblOption4;
    private javax.swing.JLabel lblTitle;
    private javax.swing.JTextArea tarContent;
    private javax.swing.JTextField txtOption1;
    private javax.swing.JTextField txtOption2;
    private javax.swing.JTextField txtOption3;
    private javax.swing.JTextField txtOption4;
    // End of variables declaration//GEN-END:variables
}
